<?php
session_start();
	include('../controller/functions.php');
	User::connection();

$userArr	= array('admin','teacher','student');
	if(!in_array($_SESSION['user'],$userArr)) {
	User::validSession();

}
if ($_GET['q'] == 'logout') 
{
	User::user_logout();
	print '		
			<script type="text/javascript">		
			window.location = "../login_r.php";
			</script>
			';


}


?>

<!--lets get it -->
<? 

//topic query again
//loop it!
$topicQuery = mysql_query("SELECT * FROM tbluser u INNER JOIN tblfrtopic t
						 ON u.userid = t.createdbyid WHERE t.views != 0;");


	
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title></title>

	<link rel="stylesheet" href="../css/style2.css" type="text/css" charset="utf-8" />
    <link rel="stylesheet" href="../css/front.css" type="text/css" charset="utf-8" />
    	<link type="text/css" href="../css/demo.css" rel="stylesheet" />
    
</head>
<body>

 <div id="page">
<div id="wrapper">
        
        		   <div class="header_top" id="header_top"> </div>
  </div>
  <div class="header2"></div> 
	<div class="header"><!--open logo -->
		  </div><!--end header -->
	<!-- close logo-->
<!-- hide the client inquiries php-->
    <?php
    echo '<div id="nav">';
    echo '<div class="underlinemenu">';
	include('menu.php');
	echo '</div>';
    echo '</div>';
	?>
    <div id="header_in"> <!--open header -->
    <p> </p>
    <? User::showUser(); ?>
    </div>
       <div id="body"> <!--open body -->
    
	 <div id="sidebar"> 
        <div id="chef_ind"> <!--open chef -->
        <div id="welcome"> <!--open welcome -->
               <!-- <h2 class="guilded"></h2> -->
        </div> <!--close welcome-->

<? echo '<p class="more">';
echo '';
 
   require('sideBar.php');
    
echo'</p>';
?>

        </div>
        
      </div><!--close left -->
    <div id="sidebar_right">

         <h2>Forum</h2>
         
            <div class="desriptionHeader">  <!--open right-->
       <div class="post6"><!--open booking -->
        

	
    <table width="650" border="0" bgcolor="#ebf9b4">
	<tr>
    	<!-- <td colspan="6"> -->
	<a class="siteloc" href="forum.php">Forum</a></td>
    </tr>
<tr>
		<!-- <td align="left" background="catbg.png" colspan="5" class="cat"> --><? print $title; ?></td>
    </tr> <? while($row  =  mysql_fetch_array($topicQuery)): 
	
		$postedid =$row['createdbyid'];
		$postedBy =$row['createdby'];
		$ava = $row['avatar'];
		$title = $row['topictitle'];
		$date = $row['topicdate'];
	?>
    
                      <tr>
                    <!-- <td valign="top" width="12%" rowspan="6"> --><td>
                      <a class="postedby" href="userprofile.php?userid=<? print $postedid; ?>"><? print $postedBy; ?></a><br />
                      <img src="profile_img/<? print $ava; ?>" width="80" height="71" border="0" />
                      </td>
                      </tr>

                      <tr>
                        <td width="58%" class="extra">Title: <? print $title; ?></td><td width="30%" align="right" class="extra"><? print $date; ?></td>
					</tr>
                      <tr>
                        <td colspan="2" height="1">

                        </td>
                      </tr>

           
                      <tr>
                      <td align="right" colspan="2">
                    
                      </td>
                      </tr>
                      <? endwhile; ?>
</table>
		
        
       
        </div>
  </div><!--close booking -->
   </div><!--close desc -->
    <?php 
	  echo '<div id="footer">';
     include('footer_view.php');
      echo '</div>';	
	  ?>
        
     	
    
   </div><!--close desc -->
    	</div> <!--close right-->
      <div class="clear">&nbsp;</div>
 <!-- footer-->


    </div><!-- close body-->
</div><!-- close page-->


</body>
</html>
